package com.hailiao.beidou.message.bd.sp

import com.hailiao.beidou.comm.serialport.SPWire
import com.hailiao.beidou.comm.serialport.device.C6503Device
import com.hailiao.beidou.comm.serialport.device.H3011Device
import com.hailiao.beidou.comm.serialport.device.H3301Device
import com.hailiao.beidou.comm.serialport.device.V1Device

/**
 * 串口通讯模式
 * @Author d10ng
 * @Date 2024/3/7 12:50
 */
enum class SPMode(val wire: SPWire?, val text: String) {
    C6503(C6503Device, "C6503"),
    FG60(C6503Device, "FG60"),
    H3301(H3301Device, "H3301"),
    H3011(H3011Device, "H3011"),
    V1(V1Device, "V1"),
    // 自定义
    CUSTOM(null, "自定义"),
    ;

    companion object{
        fun parse(value: String?) = entries.firstOrNull { it.text == value }?: CUSTOM
    }
}